package com.lyfei.yd.admin.web;

import com.lyfei.yd.common.core.domain.AjaxResult;
import com.lyfei.yd.domain.entity.Reservation;
import com.lyfei.yd.service.ReservationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/reservation")
public class ReservationController {

    @Autowired
    private ReservationService reservationService;

    @GetMapping("/page")
    public AjaxResult page(@RequestParam(defaultValue = "1") Integer current,
                           @RequestParam(defaultValue = "10") Integer pageSize) {
        return AjaxResult.success(reservationService.page(current, pageSize));
    }

    @PostMapping("/saveOrUpdate")
    public AjaxResult saveOrUpdate(@RequestBody Reservation reservation) {
        reservationService.saveOrUpdate(reservation);
        return AjaxResult.success();
    }
}
